package com.java.utils;

import java.security.MessageDigest;

public class StrUtils {
	public static boolean isNotEmpty(String data) {
		if (data == null || data.trim() == "" || data.trim().equals("")) {
			return false;
		}
		return true;
	}

	/**
	 * 加密工具
	 * 
	 * @param params
	 * @return
	 */
	public static String md5Utils(String params) {
		try {
		 char hexDigits[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
			MessageDigest message = MessageDigest.getInstance("MD5");
			byte[] md5Content = message.digest((params + "system").getBytes());
		    int j = md5Content.length;
            char str[] = new char[j * 2];
            int k = 0;
            for (int i = 0; i < j; i++) {
                byte byte0 = md5Content[i];
                str[k++] = hexDigits[byte0 >>> 4 & 0xf];
                str[k++] = hexDigits[byte0 & 0xf];
            }
			return new String(str);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	public static void main(String[] args) {
		System.out.println(md5Utils("13092788369"));
	}
}
